home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1355 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.1 KB

  1. Path: gate.net!not-for-mail
  2. From: feathers@gate.net (Michael Feathers)
  3. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
  4. Subject: Re: Hungarian notation
  5. Followup-To: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel
  6. Date: 10 Jan 1996 07:43:14 -0500
  7. Organization: CyberGate, Inc.
  8. Message-ID: <4d0c92$1va6@navajo.gate.net>
  9. References: <30C40F77.53B5@swsbbs.com> <marnoldDJEvtJ.1Lx@netcom.com> <4aleun$jlk@ns.RezoNet.NET> <marnoldDJMDBG.CFz@netcom.com> <4asnkr$7b0@solutions.solon.com> <4ath75$e7i@barnacle.iol.ie> <4b4kij$svt@news.microsoft.com> <dewar.819489496@schonberg> <4bd
  10.  <4cc2b2$11jq@navajo.gate.net> <4cud8f$gup@news.netvision.net.il>
  11. NNTP-Posting-Host: navajo.gate.net
  12. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  13.  
  14. Uri Simchoni (simchoni@netvision.net.il) wrote:
  15. : In article <4cc2b2$11jq@navajo.gate.net>, feathers@gate.net says...
  16. : >Where I work, all the truly portable code is written in terms of 
  17. : >typedefs.  We alter the typedefs in an include file to alter data
  18. : >sizes and performance characeristic, and our variant of Hungarian
  19. : >uses these type names.
  20. : I'm trying to get used to the idea...
  21. : What if you have a variable which contains the delay between two 
  22. : operations in milliseconds. Do you make up a new type, say
  23. : typedef unsigned MSEC
  24.  
  25. I don't.  I'm using typedefs, but only to decouple the code from 
  26. the intrinsic types.
  27.  
  28. I have LShortInteger, LInteger, and LLongInteger.  And all code
  29. is written in terms of those types (and LShortReal, LReal, and
  30. LLongReal).  
  31.  
  32. All these typedefs are in a global header file.  They are typdef-ed
  33. to any of the intrinsic types, with constraints like:
  34.  
  35.     sizeof (LShortInteger) <= sizeof (LInteger) <= sizeof (LLongInteger)
  36.  
  37. Maximum and minium values are defined for each of these types also
  38. based on values in float.h and limits.h.
  39.  
  40. In documentation, I call this a "virtualized type system."
  41.  
  42. It comes in real handy when you want to alter the performance characteristics
  43. of code very easily.  You can trade floats for doubles very easily for 
  44. instance if you want faster computation on some architectures.
  45.  
  46.  
  47.